#include "sise.h"
#include "sise_packer.h"

#include <stdio.h>

int main(int argc, char* argv[])
{
	const int BUF_SIZE = 100;
	char *hex1 = "124D0C1476A941C179D274E7";
	char bin1[BUF_SIZE];
	char bin2[BUF_SIZE];
	char hex2[BUF_SIZE];
	short s1, s2;
	float f1, f2;
	int i1, i2;
	double d1, d2;
	
	printf("sizeof(char) = %d\n", sizeof(char));
	printf("sizeof(short) = %d\n", sizeof(short));
	printf("sizeof(int) = %d\n", sizeof(int));
	printf("sizeof(long) = %d\n", sizeof(long));
	printf("sizeof(float) = %d\n", sizeof(float));
	printf("sizeof(double) = %d\n", sizeof(double));
	
	sise_nullify(hex2, BUF_SIZE);
	sise_nullify(bin1, BUF_SIZE);
	sise_nullify(bin2, BUF_SIZE);
	
	attacker_t at1, at2;
	int sizePacked;
	at1.id = 1203982;
	at1.type = 4;
	at1.x = 89347.1238213;
	at1.y = 1283.34957;
	
	sizePacked = sise_pack_attacker_t(bin1, &at1);
	sise_bin2hex(hex2, bin1, sizePacked);
	sise_hex2bin(hex2, bin2, sizePacked);
	sise_unpack_attacker_t(bin2, &at2);
	
	printf("at1.id = %d\n", at1.id);
	printf("at1.type = %d\n", at1.type);
	printf("at1.x = %.10f\n", at1.x);
	printf("at1.y = %.10f\n", at1.y);
	
	printf("sizePacked = %d\n", sizePacked);
	printf("bin1 = %s\n", bin1);
	printf("hex2 = %s\n", hex2);
	printf("bin2 = %s\n", bin2);
	
	printf("at2.id = %d\n", at2.id);
	printf("at2.type = %d\n", at2.type);
	printf("at2.x = %.10f\n", at2.x);
	printf("at2.y = %.10f\n", at2.y);
	
	return 0;
}
